﻿using System;

namespace Framework.Event
{
    /// <summary>
    /// 事件管理接口
    /// </summary>
    public interface IEventManager
    {
        /// <summary>
        /// 事件数量
        /// </summary>
        int EventCount { get; }
        /// <summary>
        /// 订阅事件
        /// </summary>
        /// <param name="eventId">事件Id</param>
        /// <param name="handler">事件参数</param>
        void Subscriber(int eventId, EventHandler<IEventArg> handler);
        /// <summary>
        /// 取消订阅事件
        /// </summary>
        /// <param name="eventId">事件Id</param>
        /// <param name="handler">事件参数</param>
        void UnSubscriber(int eventId, EventHandler<IEventArg> handler);
        /// <summary>
        /// 抛出事件
        /// </summary>
        /// <param name="sender">事件抛出对象</param>
        /// <param name="arg">事件参数</param>
        void Fire(object sender, IEventArg arg);
        /// <summary>
        /// 立刻抛出事件
        /// </summary>
        /// <param name="sender">事件抛出对象</param>
        /// <param name="arg">事件参数</param>
        void FireNow(object sender, IEventArg arg);
    }
}
